Finished implementing, now for the testing phase.

This commit is contained in:
2025-01-26 21:43:17 -08:00
parent 7bc4b9977d
commit 981b40d3b1
47 changed files with 2070 additions and 1597 deletions

View File

@@ -9,9 +9,7 @@ namespace ehs
class EHS_LIB_IO BaseUDP
{
protected:
AddrType type;
Str_8 address;
UInt_16 port;
Endpoint localEndpoint;
bool bound;
public:
@@ -22,7 +20,7 @@ namespace ehs
/// Properly initializes the socket.
/// @param [in] type The ip version to initialize the socket with.
BaseUDP(AddrType type);
BaseUDP(IP version);
BaseUDP(BaseUDP&& udp) noexcept;
@@ -40,13 +38,13 @@ namespace ehs
/// @param [in] address The ip address to bind to.
/// @param [in] port The port to bind to.
/// @note Used for servers.
virtual void Bind(AddrType type, const Str_8& address, UInt_16 port) = 0;
virtual void Bind(const Endpoint &endpoint) = 0;
/// Sends data to the endpoint.
/// @param [in] type The ip version of the endpoint.
/// @param [in] address The ip address of the endpoint.
/// @param [in] port The port of the endpoint is bound to.
virtual UInt_64 Send(AddrType type, const Str_8& address, UInt_16 port, const Byte* data, UInt_64 size) = 0;
virtual UInt_64 Send(const Endpoint &endpoint, const Byte *data, UInt_64 size) = 0;
/// Receives data from the endpoint.
/// @param [out] type The ip version of the endpoint.
@@ -55,7 +53,7 @@ namespace ehs
/// @param [out] data The incoming data from the endpoint.
/// @param [in] size The max size of the buffer in bytes to store the data.
/// @returns The size of the incoming data in bytes.
virtual UInt_64 Receive(AddrType* type, Str_8* address, UInt_16* port, Byte* data, UInt_64 size) = 0;
virtual UInt_64 Receive(Endpoint *endpoint, Byte *data, UInt_64 size) = 0;
/// Retrieves whether or not this socket is bound to an ip address and port.
/// @returns The result.
@@ -73,17 +71,7 @@ namespace ehs
virtual bool IsIPv6Only() const = 0;
/// Retrieves the bound ip version.
/// @returns The result.
AddrType GetLocalAddressType() const;
/// Retrieves the bound ip address.
/// @returns The bound ip address.
Str_8 GetLocalAddress() const;
/// Retrieves the bound port.
/// @returns The bound port.
UInt_16 GetLocalPort() const;
Endpoint GetLocalEndpoint() const;
/// Retrieves whether or not this socket was initialized.
/// @returns The result.